package com.leo.filter;

import javax.annotation.Resource;

import org.apache.struts2.ServletActionContext;

import com.leo.business.AdminBusiness;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

public class AdminInterceptor extends MethodFilterInterceptor {

	private static final long serialVersionUID = -782706110048048600L;
	@Resource
	AdminBusiness adminBusiness;
	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		ServletActionContext.getResponse().setHeader("Cache-Control", "no-cache");
		if (!adminBusiness.isLogin()) {
			// 登录超时
			return "logintimeout";
		}
		return invocation.invoke();
	}
}
